﻿using Ionic.Zip;
using Pdf2epub.Epub;
using System;
using System.Collections.Generic;
using System.Xml;

namespace SharpEpub
{
    public abstract class AbstractFile
    {
        protected string bookGuid = Guid.NewGuid().ToString();
        protected List<string> contentItems;
        protected ZipFile file;
        protected EpubStructure structure;
        protected XmlDocument xmlDocument;

        protected AbstractFile(EpubStructure structure, ZipFile file)
        {
            UpdatStructure(structure, file);
        }

        public string GetBookId { get { return bookGuid; } }

        public string BuildAndGetContent()
        {
            Build();
            return xmlDocument.OuterXml;
        }

        public XmlDocument BuildAndGetXmlDocument()
        {
            Build();
            return xmlDocument;
        }

        public void UpdatStructure(EpubStructure structure, ZipFile file)
        {
            this.file = file;
            this.structure = structure;
        }

        protected abstract void Build();
    }
}